/**
 * JAVACC DEMO 1.0
 * @copy right dwusoft company All rights reserved. 
 */
package com.apache.order.service.plugins;

import com.apache.api.manager.PluginConnector;
import com.apache.api.vo.ParamsVo;
import com.apache.api.vo.ResultEntity;
import com.apache.cache.util.Validator;
import com.apache.order.entity.OrderLogMessage;
import com.apache.order.manager.OrderLogMessageManager;

/**
 * description:  订单引擎操作记录列表
 * @author Hou Dayu 创建时间：2015-8-14  
 */
public class LogMessageListPluginImpl implements PluginConnector {

	private OrderLogMessageManager orderLogMessageManager;

	/**
	 * TODO 简单描述该方法的实现功能（可选）.  
	 * @see com.dwusoft.api.manager.PluginConnector#execute(com.dwusoft.api.vo.ParamsVo)  
	 */
	public Object execute(ParamsVo arg0) throws Exception {
		ResultEntity entity = new ResultEntity();
		OrderLogMessage logMessage = new OrderLogMessage();
		logMessage.setObjId(String.valueOf(arg0.getParams("objId")));
		logMessage.setUserEname(String.valueOf(arg0.getParams("userEname")));
		String pageIndex = Validator.getDefaultStr(String.valueOf(arg0.getParams("pageIndex")), "0");
		String pageSize = Validator.getDefaultStr(String.valueOf(arg0.getParams("pageSize")), "0");
		ParamsVo<OrderLogMessage> pvo = new ParamsVo<OrderLogMessage>();
		pvo.setObj(logMessage);
		if ("0".equals(pageIndex) || "0".equals(pageSize)) {
			entity.setEntity(orderLogMessageManager.getList(pvo));
		} else {
			pvo.setParams("pageIndex", pageIndex);
			pvo.setParams("pageSize", pageSize);
			entity.setEntity(orderLogMessageManager.getPageInfo(pvo));
		}
		entity.setResult("查询成功");
		entity.setResult("true");
		return entity;
	}

	public void setOrderLogMessageManager(OrderLogMessageManager orderLogMessageManager) {
		this.orderLogMessageManager = orderLogMessageManager;
	}

}
